﻿$(function () {
    layui.use('form', function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.jquery;

        

        //表单提交
        form.on('submit(submit)', function (data) {

            $.ajax({
                url: '/Role/AddRoleInfo',
                method: 'post',
                data: data.field,
                dataType: 'JSON',
                success: function (data) {
                    if (data.success) {
                        layer.msg(data.msg, {
                            title: '提示框',
                            icon: 1,
                            time: 3000,
                            end: function () {
                                window.location.href = '/Role/Index';
                            }
                        });
                    }
                    else {
                        layer.alert(data.msg);
                        return false;
                    }
                },
                error: function (data) {

                }
            });
        });
    });
});